//
//  ZYBaseViewController.m
//  ZYOils
//
//  Created by 段新瑞 on 2019/9/23.
//  Copyright © 2019 Mr.Xr. All rights reserved.
//

#import "ZYBaseViewController.h"


@interface ZYBaseViewController ()

@end

@implementation ZYBaseViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    [self.view setBackgroundColor:BACKGROUNDCOLOR];
    [self configNavigationBar];
    
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    
    return UIStatusBarStyleLightContent;
}


- (void)configNavigationBar {
    
    self.navigationController.navigationBar.barTintColor = CustomNavBarBackgroundColor;
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBar.shadowImage = [UIImage new];
    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor], NSFontAttributeName: [UIFont systemFontOfSize:17]};
}

- (BOOL)canBecomeFirstResponder {
    
    return YES;
}

- (UIBarButtonItem *)rt_customBackItemWithTarget:(id)target
                                          action:(SEL)action {
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setImage:[UIImage imageNamed:@"navigation_back_white"] forState:UIControlStateNormal];
    [button sizeToFit];
    [button setFrame:CGRectMake(0, 0, 44, 44)];
    button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return [[UIBarButtonItem alloc] initWithCustomView:button];
}

- (XREmptyView *)emptyView:(XREmptyViewState)state {
    if (state == XREmptyViewStateNoData) {
        XREmptyView *emptyView = [XREmptyView diyEmptyView];
        emptyView.emptyViewIsCompleteCoverSuperView = YES;
        return emptyView;
    } else {
        XREmptyView *emptyView = [XREmptyView diyEmptyActionViewWithTarget:self action:@selector(requestRefreshData)];
        emptyView.emptyViewIsCompleteCoverSuperView = YES;
        return emptyView;
    }
}

- (void)requestRefreshData {}


@end
